<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateShopDistribution extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_distribution', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger("shopId")->default(0)->comment("店铺ID");
            $table->string('serialNo', 64)->default('')->comment('渠道编号');
            $table->string('partnerName', 64)->default('')->comment('合作方名称');
            $table->unsignedInteger('provinceCode')->default(0)->comment('地址-省Code');
            $table->unsignedInteger('cityCode')->default(0)->comment('地址-市Code');
            $table->unsignedInteger('countyCode')->default(0)->comment('地址-区Code');
            $table->string('detailInfo', 255)->default('')->comment('详细地址');
            $table->string('cooperationLeader', 64)->default('')->comment('合作负责人');
            $table->string('mobile', 64)->default('')->comment('联系方式');
            $table->double('ratio')->default(0)->comment('分佣比例');
            $table->tinyInteger("settlementCycleType")->default(0)->comment("结算周期 1:周,2:月");
            $table->unsignedInteger('minDeliveryAmount')->default(0)->comment('单笔订单起送金额');
            $table->tinyInteger("status")->default(1)->comment("状态 1:正常,2:终止");
            $table->string('qrCodeUrl', 255)->default('')->comment('二维码链接url');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");

            $table->comment = '店铺分销表';
            $table->index('shopId', 'idx_shopId');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_distribution');
    }
}
